<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<html>
<head>
<title>新闻管理</title>
<%@include file="/common/ec.jsp"%>
<%@include file="/common/extjs.jsp"%>
<%@include file="/common/meta.jsp"%>
</head>
<body>
<div class="x-panel">
<div class="x-panel-header">新闻管理</div>
<div class="x-toolbar">
<table width="99%">
  <tr>
    <s:form action="index.do" method="post">
	    <td width="40">标题：</td>
	    <td><s:textfield name="model.title" size="30"/></td>
	    <td width="40">类别：</td>	    
	    <td width="140">
            <s:select id="newsTypeMap" list="newsTypeMap" name="model.newsType.id" headerKey="" 
                 headerValue="请选择" cssStyle="width:120px;" />
		</td>  
		<td align="right" width="65" style="vertical-align: middle">起始时间：</td>
	    <td style="vertical-align: middle" width="70">
			<input type="text" name="startTime" style="width: 100px"
				value='<s:date name="startTime" format="yyyy-MM-dd"/>'
				onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'endTime\')}',skin:'whyGreen',dateFmt:'yyyy-MM-dd'})"
				class="Wdate" />
        </td>   
        <td align="right" width="65" style="vertical-align: middle">终止时间：</td>
	    <td style="vertical-align: middle" width="70">
  			<input type="text" name="endTime" style="width: 100px"
				value='<s:date name="endTime" format="yyyy-MM-dd"/>'
				onfocus="WdatePicker({minDate:'#F{$dp.$D(\'startTime\')}',skin:'whyGreen',dateFmt:'yyyy-MM-dd'})"
				class="Wdate" />
        </td> 		
	    <td><input type="submit" value="查询" class="button" /></td>
	    <td style=" padding-left:5px; padding-top:5px;" align="right">   
	        <a href="${ctx}/news/edit.do"><img src="${ctx}/images/icons/add.gif">添加新闻</a>
	    </td>
    </s:form>
  </tr>
</table>
</div>
<div class="x-panel-body">
<ec:table
	items="items" 
	var="item" 
	retrieveRowsCallback="process"
	sortRowsCallback="process" 
	action="index.do" 
	useAjax="false"
	doPreload="false" 
	pageSizeList="20,50,100,200" 
	editable="false"
	sortable="false" 
	rowsDisplayed="20" 
	generateScript="true"
	resizeColWidth="false" 
	classic="false" 
	width="100%" 
	height="460px"
	minHeight="460"
	toolbarContent="navigation|pagejump|pagesize|refresh|extend|status">
	<ec:row>
	    <ec:column width="40" property="_s" title="No." value="${GLOBALROWCOUNT}" sortable="false" style="text-align:center"/>
		<ec:column width="290" property="title" title="标题" ellipsis="true">
		<a href="${ctx}/news/view.do?model.id=${item.id}" title="查看新闻" target="_blank"><font color="blue">${item.title}</font></a>
		</ec:column>
		<ec:column width="100" property="newsType.name" title="新闻类别" style="text-align:left"  />		
		<ec:column width="100" property="author.name" title="发布人" style="text-align:center"/>
		<ec:column width="70" property="hits" title="点击次数" style="text-align:center"/>
		
		<ec:column width="140" property="createTime" title="发布时间" style="text-align:center" format="yyyy-MM-dd HH:mm:ss" cell="date"/>
		<ec:column width="100" property="_0" title="操作" style="text-align:center" sortable="false">
		<a href="${ctx}/news/edit.do?model.id=${item.id}" title="修改新闻">编辑</a> | 
		<a href="#" onclick="remove(${item.id})" title="删除新闻">删除</a>  	
		</ec:column>
	</ec:row>
</ec:table>
</div>
</div>
<script type="text/javascript">
  function remove(id) {
    Ext.MessageBox.confirm('提示','确认要删除所选择的新闻吗？删除后不能恢复！', function(btn){
        if (btn == 'yes') {
          window.location = "${ctx}/news/remove.do?model.id=" + id;
        }
    });
  }
	
  function refresh() {
    ECSideUtil.reload('ec');
  }
</script>
</body>
</html>